home *** CD-ROM | disk | FTP | other *** search
/ CU Amiga Super CD-ROM 17 / CU Amiga Magazine's Super CD-ROM 17 (1997)(EMAP Images)(GB)[!][issue 1997-12].iso / CUCD / Programming / DiceSource / doc / ctype.doc < prev    next >
Text File  |  1993-07-05  |  14KB  |  586 lines

  1.  
  2.     CTYPE.DOC (c)Copyright 1990, Matthew Dillon, All Rights Reserved
  3.  
  4. TABLE OF CONTENTS
  5.  
  6. c.lib/ctype/isalnum
  7. c.lib/ctype/isalpha
  8. c.lib/ctype/iscntrl
  9. c.lib/ctype/isdigit
  10. c.lib/ctype/isgraph
  11. c.lib/ctype/islower
  12. c.lib/ctype/isprint
  13. c.lib/ctype/ispunct
  14. c.lib/ctype/isspace
  15. c.lib/ctype/isupper
  16. c.lib/ctype/isxdigit
  17. c.lib/ctype/tolower
  18. c.lib/ctype/toupper
  19.  
  20.  
  21. ctype/isalnum                        ctype/isalnum
  22.  
  23.    NAME
  24.     isalnum - check that a character is in the alpha numeric domain
  25.  
  26.    SYNOPSIS
  27.     int r = isalnum(c);
  28.     int c;
  29.  
  30.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  31.     you do not.
  32.  
  33.    FUNCTION
  34.     Returns non-zero if the character is an alpha numeric (a-z, A-Z, 0-9),
  35.     zero if it is not.
  36.  
  37.    NOTE
  38.     When a non-zero value is returned, this value can be *anything*
  39.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  40.     fit in a short, however, and still remain non-zero.
  41.  
  42.     characters in the 128-255 range are valid inputs.  characters
  43.     less than -1 or larger than 255 are ILLEGAL and the results will
  44.     be random.  If you are passing a CHAR, you must cast it to an
  45.     UNSIGNED CHAR first.
  46.  
  47.     EOF is a valid input an always returns false
  48.  
  49.    EXAMPLE
  50.     #include <ctype.h>
  51.     #include <assert.h>
  52.  
  53.     main()
  54.     {
  55.         assert(isalnum('a'));
  56.         assert(isalnum('Z'));
  57.         assert(isalnum('1'));
  58.         assert(!isalnum('%'));
  59.     }
  60.  
  61.    INPUTS
  62.     int c;        character that we are checking
  63.  
  64.    RESULTS
  65.     int r;        0 if the check failed, non-zero if the check is true
  66.  
  67.    SEE ALSO
  68.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  69.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  70.  
  71.  
  72. ctype/isalpha                        ctype/isalpha
  73.  
  74.    NAME
  75.     isalpha - check that a character is in the alphabetic domain
  76.  
  77.    SYNOPSIS
  78.     int r = isalpha(c);
  79.     int c;
  80.  
  81.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  82.     you do not.
  83.  
  84.    FUNCTION
  85.     Returns non-zero if the character is a letter in the alphabet
  86.     (a-z, A-Z), zero if it is not.
  87.  
  88.    NOTE
  89.     When a non-zero value is returned, this value can be *anything*
  90.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  91.     fit in a short, however, and still remain non-zero.
  92.  
  93.     characters in the 128-255 range are valid inputs.  characters
  94.     less than -1 or larger than 255 are ILLEGAL and the results will
  95.     be random.  If you are passing a CHAR, you must cast it to an
  96.     UNSIGNED CHAR first.
  97.  
  98.     EOF is a valid input an always returns false
  99.  
  100.    EXAMPLE
  101.     #include <ctype.h>
  102.     #include <assert.h>
  103.  
  104.     main()
  105.     {
  106.         assert(isalpha('a'));
  107.         assert(isalpha('Z'));
  108.         assert(!isalpha('1'));
  109.         assert(!isalpha('%'));
  110.     }
  111.  
  112.    INPUTS
  113.     int c;        character that we are checking
  114.  
  115.    RESULTS
  116.     int r;        0 if the check failed, non-zero if the check is true
  117.  
  118.    SEE ALSO
  119.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  120.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  121.  
  122.  
  123. ctype/iscntrl                        ctype/iscntrl
  124.  
  125.    NAME
  126.     iscntrl - check for a control character
  127.  
  128.    SYNOPSIS
  129.     int r = iscntrl(c);
  130.     int c;
  131.  
  132.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  133.     you do not.
  134.  
  135.    FUNCTION
  136.     Returns non-zero if the character is a control character (0-31),
  137.     zero if it is not.
  138.  
  139.    NOTE
  140.     When a non-zero value is returned, this value can be *anything*
  141.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  142.     fit in a short, however, and still remain non-zero.
  143.  
  144.     characters in the 128-255 range are valid inputs.  characters
  145.     less than -1 or larger than 255 are ILLEGAL and the results will
  146.     be random.  If you are passing a CHAR, you must cast it to an
  147.     UNSIGNED CHAR first.
  148.  
  149.     EOF is a valid input an always returns false
  150.  
  151.    EXAMPLE
  152.     #include <ctype.h>
  153.     #include <assert.h>
  154.  
  155.     main()
  156.     {
  157.         assert(iscntrl(10));
  158.         assert(iscntrl(8));
  159.         assert(!iscntrl('1'));
  160.         assert(!iscntrl('%'));
  161.     }
  162.  
  163.    INPUTS
  164.     int c;        character that we are checking
  165.  
  166.    RESULTS
  167.     int r;        0 if the check failed, non-zero if the check is true
  168.  
  169.    SEE ALSO
  170.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  171.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  172.  
  173.  
  174. ctype/isdigit                        ctype/isdigit
  175.  
  176.    NAME
  177.     isdigit - check for a numeric character
  178.  
  179.    SYNOPSIS
  180.     int r = isdigit(c);
  181.     int c;
  182.  
  183.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  184.     you do not.
  185.  
  186.    FUNCTION
  187.     Returns non-zero if the character is a digit ('0' through '9'),
  188.     zero if it is not.
  189.  
  190.    NOTE
  191.     When a non-zero value is returned, this value can be *anything*
  192.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  193.     fit in a short, however, and still remain non-zero.
  194.  
  195.     characters in the 128-255 range are valid inputs.  characters
  196.     less than -1 or larger than 255 are ILLEGAL and the results will
  197.     be random.  If you are passing a CHAR, you must cast it to an
  198.     UNSIGNED CHAR first.
  199.  
  200.     EOF is a valid input an always returns false
  201.  
  202.    EXAMPLE
  203.     #include <ctype.h>
  204.     #include <assert.h>
  205.  
  206.     main()
  207.     {
  208.         assert(isdigit('9'));
  209.         assert(isdigit('0'));
  210.         assert(!isdigit('x'));
  211.         assert(!isdigit(7));
  212.     }
  213.  
  214.    INPUTS
  215.     int c;        character that we are checking
  216.  
  217.    RESULTS
  218.     int r;        0 if the check failed, non-zero if the check is true
  219.  
  220.    SEE ALSO
  221.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  222.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  223.  
  224.  
  225. ctype/isgraph                        ctype/isgraph
  226.  
  227.    NAME
  228.     isgraph - check for a printable character, excludes the space character
  229.  
  230.    SYNOPSIS
  231.     int r = isgraph(c);
  232.     int c;
  233.  
  234.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  235.     you do not.
  236.  
  237.    FUNCTION
  238.     Returns non-zero if the character is printable and not a space,
  239.     zero otherwise.
  240.  
  241.     This function is the isprint() function but with space character
  242.     excluded from the printable set.
  243.  
  244.    NOTE
  245.     When a non-zero value is returned, this value can be *anything*
  246.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  247.     fit in a short, however, and still remain non-zero.
  248.  
  249.     characters in the 128-255 range are valid inputs.  characters
  250.     less than -1 or larger than 255 are ILLEGAL and the results will
  251.     be random.  If you are passing a CHAR, you must cast it to an
  252.     UNSIGNED CHAR first.
  253.  
  254.     EOF is a valid input an always returns false
  255.  
  256.    EXAMPLE
  257.     #include <ctype.h>
  258.     #include <assert.h>
  259.  
  260.     main()
  261.     {
  262.         assert(isgraph('^'));
  263.         assert(isgraph('$'));
  264.         assert(!isgraph(' '));
  265.         assert(!isgraph(127));
  266.     }
  267.  
  268.    INPUTS
  269.     int c;        character that we are checking
  270.  
  271.    RESULTS
  272.     int r;        0 if the check failed, non-zero if the check is true
  273.  
  274.    SEE ALSO
  275.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  276.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  277.  
  278.  
  279. ctype/islower                        ctype/islower
  280.  
  281.    NAME
  282.     islower - check for a lower case alphabetic character
  283.  
  284.    SYNOPSIS
  285.     int r = islower(c);
  286.     int c;
  287.  
  288.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  289.     you do not.
  290.  
  291.    FUNCTION
  292.     Returns non-zero if the character is a lower case letter 'a' - 'z',
  293.     zero otherwise.
  294.  
  295.    NOTE
  296.     When a non-zero value is returned, this value can be *anything*
  297.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  298.     fit in a short, however, and still remain non-zero.
  299.  
  300.     characters in the 128-255 range are valid inputs.  characters
  301.     less than -1 or larger than 255 are ILLEGAL and the results will
  302.     be random.  If you are passing a CHAR, you must cast it to an
  303.     UNSIGNED CHAR first.
  304.  
  305.     EOF is a valid input an always returns false
  306.  
  307.    EXAMPLE
  308.     #include <ctype.h>
  309.     #include <assert.h>
  310.  
  311.     main()
  312.     {
  313.         assert(islower('a'));
  314.         assert(islower('g'));
  315.         assert(!islower('Z'));
  316.         assert(!islower(127));
  317.     }
  318.  
  319.    INPUTS
  320.     int c;        character that we are checking
  321.  
  322.    RESULTS
  323.     int r;        0 if the check failed, non-zero if the check is true
  324.  
  325.    SEE ALSO
  326.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  327.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  328.  
  329.  
  330. ctype/isprint                        ctype/isprint
  331.  
  332.    NAME
  333.     isprint - check for a printable character, includes the space character
  334.  
  335.    SYNOPSIS
  336.     int r = isprint(c);
  337.     int c;
  338.  
  339.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  340.     you do not.
  341.  
  342.    FUNCTION
  343.     Returns non-zero if the character is printable, zero otherwise.
  344.  
  345.     This function is the isgraph() function but with space character
  346.     included in the printable set.
  347.  
  348.    NOTE
  349.     When a non-zero value is returned, this value can be *anything*
  350.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  351.     fit in a short, however, and still remain non-zero.
  352.  
  353.     characters in the 128-255 range are valid inputs.  characters
  354.     less than -1 or larger than 255 are ILLEGAL and the results will
  355.     be random.  If you are passing a CHAR, you must cast it to an
  356.     UNSIGNED CHAR first.
  357.  
  358.     EOF is a valid input an always returns false
  359.  
  360.    EXAMPLE
  361.     #include <ctype.h>
  362.     #include <assert.h>
  363.  
  364.     main()
  365.     {
  366.         assert(isprint(' '));
  367.         assert(isprint('^'));
  368.         assert(!isprint(23));
  369.         assert(!isprint(127));
  370.     }
  371.  
  372.    INPUTS
  373.     int c;        character that we are checking
  374.  
  375.    RESULTS
  376.     int r;        0 if the check failed, non-zero if the check is true
  377.  
  378.    SEE ALSO
  379.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  380.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  381.  
  382.  
  383. ctype/isupper                        ctype/isupper
  384.  
  385.    NAME
  386.     isupper - check for an upper case alphabetic character
  387.  
  388.    SYNOPSIS
  389.     int r = isupper(c);
  390.     int c;
  391.  
  392.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  393.     you do not.
  394.  
  395.    FUNCTION
  396.     Returns non-zero if the character is an upper case letter 'A' - 'Z',
  397.     zero otherwise.
  398.  
  399.    NOTE
  400.     When a non-zero value is returned, this value can be *anything*
  401.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  402.     fit in a short, however, and still remain non-zero.
  403.  
  404.     characters in the 128-255 range are valid inputs.  characters
  405.     less than -1 or larger than 255 are ILLEGAL and the results will
  406.     be random.  If you are passing a CHAR, you must cast it to an
  407.     UNSIGNED CHAR first.
  408.  
  409.     EOF is a valid input an always returns false
  410.  
  411.    EXAMPLE
  412.     #include <ctype.h>
  413.     #include <assert.h>
  414.  
  415.     main()
  416.     {
  417.         assert(isupper('A'));
  418.         assert(isupper('G'));
  419.         assert(!isupper('z'));
  420.         assert(!isupper(127));
  421.     }
  422.  
  423.    INPUTS
  424.     int c;        character that we are checking
  425.  
  426.    RESULTS
  427.     int r;        0 if the check failed, non-zero if the check is true
  428.  
  429.    SEE ALSO
  430.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  431.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  432.  
  433.  
  434. ctype/isxdigit                        ctype/isxdigit
  435.  
  436.    NAME
  437.     isxdigit - check for a character representable as a hexadecimal digit
  438.  
  439.    SYNOPSIS
  440.     int r = isxdigit(c);
  441.     int c;
  442.  
  443.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  444.     you do not.
  445.  
  446.    FUNCTION
  447.     Returns non-zero if the character represents a hexadecimal digit
  448.     '0' - '9', 'a' - 'f', or 'A' - 'F', zero otherwise.
  449.  
  450.    NOTE
  451.     When a non-zero value is returned, this value can be *anything*
  452.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  453.     fit in a short, however, and still remain non-zero.
  454.  
  455.     characters in the 128-255 range are valid inputs.  characters
  456.     less than -1 or larger than 255 are ILLEGAL and the results will
  457.     be random.  If you are passing a CHAR, you must cast it to an
  458.     UNSIGNED CHAR first.
  459.  
  460.     EOF is a valid input an always returns false
  461.  
  462.    EXAMPLE
  463.     #include <ctype.h>
  464.     #include <assert.h>
  465.  
  466.     main()
  467.     {
  468.         assert(isxdigit('9'));
  469.         assert(isxdigit('0'));
  470.         assert(isxdigit('A'));
  471.         assert(isxdigit('d'));
  472.         assert(!isxdigit('x'));
  473.         assert(!isxdigit(27));
  474.     }
  475.  
  476.    INPUTS
  477.     int c;        character that we are checking
  478.  
  479.    RESULTS
  480.     int r;        0 if the check failed, non-zero if the check is true
  481.  
  482.    SEE ALSO
  483.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  484.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  485.  
  486.  
  487. ctype/tolower                        ctype/tolower
  488.  
  489.    NAME
  490.     tolower - converts a character into lower case
  491.  
  492.    SYNOPSIS
  493.     int lc = tolower(c);
  494.     int c;
  495.  
  496.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  497.     you do not.
  498.  
  499.    FUNCTION
  500.     If the character is in upper case the equivalent lower case
  501.     character is returned, else the argument is returned (i.e. no
  502.     change)
  503.  
  504.    NOTE
  505.     When a non-zero value is returned, this value can be *anything*
  506.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  507.     fit in a short, however, and still remain non-zero.
  508.  
  509.     characters in the 128-255 range are valid inputs.  characters
  510.     less than -1 or larger than 255 are ILLEGAL and the results will
  511.     be random.  If you are passing a CHAR, you must cast it to an
  512.     UNSIGNED CHAR first.
  513.  
  514.     EOF is a valid input an always returns false
  515.  
  516.    EXAMPLE
  517.     #include <stdio.h>
  518.     #include <ctype.h>
  519.  
  520.  
  521.     main()
  522.     {
  523.         printf("%c%c%c%c", tolower('a'), tolower('B'), tolower('%'), tolower('Q'));
  524.     }
  525.  
  526.    INPUTS
  527.     int c;        character that we are checking
  528.  
  529.    RESULTS
  530.     int r;        converted character
  531.  
  532.    SEE ALSO
  533.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  534.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  535.  
  536.  
  537. ctype/toupper                        ctype/toupper
  538.  
  539.    NAME
  540.     toupper - converts a character into upper case
  541.  
  542.    SYNOPSIS
  543.     int lc = toupper(c);
  544.     int c;
  545.  
  546.     This is a MACRO if you #include <ctype.h>, a subroutine call if
  547.     you do not.
  548.  
  549.    FUNCTION
  550.     If the character is in lower case the equivalent upper case
  551.     character is returned, else the argument is returned (i.e. no
  552.     change)
  553.  
  554.    NOTE
  555.     When a non-zero value is returned, this value can be *anything*
  556.     other than zero.  It is not necessarily a 1.  It is guarenteed to
  557.     fit in a short, however, and still remain non-zero.
  558.  
  559.     characters in the 128-255 range are valid inputs.  characters
  560.     less than -1 or larger than 255 are ILLEGAL and the results will
  561.     be random.  If you are passing a CHAR, you must cast it to an
  562.     UNSIGNED CHAR first.
  563.  
  564.     EOF is a valid input an always returns false
  565.  
  566.    EXAMPLE
  567.     #include <stdio.h>
  568.     #include <ctype.h>
  569.  
  570.  
  571.     main()
  572.     {
  573.         printf("%c%c%c%c", toupper('a'), toupper('B'), toupper('%'), toupper('Q'));
  574.     }
  575.  
  576.    INPUTS
  577.     int c;        character that we are checking
  578.  
  579.    RESULTS
  580.     int r;        converted character
  581.  
  582.    SEE ALSO
  583.     isalnum, isalpha, iscntrl, isdigit, isgraph, islower, isprint,
  584.     ispunct, isspace, isupper, isxdigit, tolower, toupper
  585.  
  586.